package com.jnzc.ocr.serv.shop.api.impl;

import com.jnzc.ocr.common.bean.PageResult;
import com.jnzc.ocr.serv.shop.api.ShopStockApi;
import com.jnzc.ocr.serv.shop.entity.ShopStock;
import com.jnzc.ocr.serv.shop.filter.ShopStockFilter;
import com.jnzc.ocr.serv.shop.service.ShopStockService;
import com.jnzc.ocr.serv.shop.vo.ShopStockCreateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangcm
 * @version 1.0, 2017-09-29
 */
@RestController
public class ShopStockApiImpl implements ShopStockApi {

    @Autowired
    private ShopStockService shopStockService;

    @Override
    public ShopStock find(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        return shopStockService.find(id, shopId);
    }

    @Override
    public PageResult<ShopStock> search(@RequestBody ShopStockFilter filter, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        return shopStockService.search(filter, pageNo, pageSize);
    }

    @Override
    public ShopStock save(@RequestBody ShopStockCreateVo vo, Long shopId) {
        return shopStockService.save(vo, shopId);
    }
}
